import java.util.Random;

/**
 * contains static methods needed for the game
 * @author paul peasegood
 *
 */
public class GameEngine {

	/**
	 * rolls one dice
	 * @param diceSides - number of sides on dice to roll
	 * @return roll result
	 */
	 public static int roll(int diceSides)
     {
             int total = 0;
             Random dice = new Random();
             total = total + dice.nextInt(diceSides) +1;
             return total;
     }
	
	 /**
	  * rolls any number of dice
	  * @param diceNum - number of dice to roll
	  * @param diceSides - number of sides of dice to be rolled
	  * @return total of all rolls
	  */
	 public static int roll(int diceNum, int diceSides)
     {
             int total = 0;
             Random dice = new Random();
             for (int i = 0; i < diceNum; i ++)
             {
                     total = total + dice.nextInt(diceSides) +1;
             }
             return total;
     }
	/**
	 * rolls and number of dice and adds on a bonus
	 * @param diceNum - number of dice to roll
	 * @param diceSides - number of sides of dice to be rolled
	 * @param bonus - bonus to be added on to total
	 * @return total of all rolls
	 */
	 public static int roll(int diceNum, int diceSides,int bonus)
     {
             int total = 0;
             Random dice = new Random();
             for (int i = 0; i < diceNum; i ++)
             {
                     total = total + dice.nextInt(diceSides) +1;
             }
             total = total + bonus;
             return total;
     }
	 
}
